<html>
<head><meta charset="utf-8"><title>Dataflow question · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html">Dataflow question</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="189070750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189070750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189070750">(Feb 25 2020 at 23:08)</a>:</h4>
<p>In <code>src/librustc_mir/dataflow/impls/borrows.rs</code> why does Terminator::Call not need to call <code>kill_borrows_on_place()</code> for its destination place, while Statement::Assign does?</p>



<a name="189070778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189070778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189070778">(Feb 25 2020 at 23:09)</a>:</h4>
<p>I'm trying to understand this code to figure out if I need to add handling for Terminator::InlineAsm, which I am adding.</p>



<a name="189070800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189070800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189070800">(Feb 25 2020 at 23:09)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> (<span class="user-mention" data-user-id="119009">@eddyb</span> suggested you might be familiar with this code)</p>



<a name="189071895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189071895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189071895">(Feb 25 2020 at 23:27)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> No idea. It seems like it should kill any borrows of the return place in <code>call_return_effect</code>. This wasn't implemented by me, as the semantics are unchanged <a href="https://github.com/rust-lang/rust/blob/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_mir/dataflow/impls/borrows.rs#L318" target="_blank" title="https://github.com/rust-lang/rust/blob/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_mir/dataflow/impls/borrows.rs#L318">from at least 1.35</a>, which was before I worked on rust. You probably need to ask <span class="user-mention" data-user-id="116083">@pnkfelix</span>.</p>



<a name="189072709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189072709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189072709">(Feb 25 2020 at 23:40)</a>:</h4>
<p>Is the goal to eventually support unwinding out of <code>InlineAsm</code>?</p>



<a name="189072979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189072979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189072979">(Feb 25 2020 at 23:44)</a>:</h4>
<p>Maybe in the future. The more immediate reason is to support diverging InlineAsm</p>



<a name="189073125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073125">(Feb 25 2020 at 23:46)</a>:</h4>
<p>But you want a "success" edge and an "unwind" edge like <code>Call</code>, correct?</p>



<a name="189073233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073233">(Feb 25 2020 at 23:48)</a>:</h4>
<p>Not really, just a success edge for now.</p>



<a name="189073296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073296">(Feb 25 2020 at 23:49)</a>:</h4>
<p>Here's the MIR part of the PR if you want to have a look: <a href="https://github.com/rust-lang/rust/pull/69171/commits/8d3b9ba81e2cebb0d2bc528ea523243723813ef9" target="_blank" title="https://github.com/rust-lang/rust/pull/69171/commits/8d3b9ba81e2cebb0d2bc528ea523243723813ef9">https://github.com/rust-lang/rust/pull/69171/commits/8d3b9ba81e2cebb0d2bc528ea523243723813ef9</a></p>



<a name="189073438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073438">(Feb 25 2020 at 23:51)</a>:</h4>
<p>If there's only ever one edge out of <code>InlineAsm</code>, does it need to be converted to a terminator as part of your PR? Or can it remain a statement for now?</p>



<a name="189073537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073537">(Feb 25 2020 at 23:52)</a>:</h4>
<p>I mean, I think it <em>should</em> ultimately be a terminator, but does it save work to make that change now as opposed to later?</p>



<a name="189073705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073705">(Feb 25 2020 at 23:55)</a>:</h4>
<p>Well I'm not using any of the existing InlineAsm code, it's more of a rewrite from scratch.</p>



<a name="189073718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073718">(Feb 25 2020 at 23:55)</a>:</h4>
<p>The old InlineAsm was renamed to LlvmInlineAsm (see first commit)</p>



<a name="189073734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189073734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189073734">(Feb 25 2020 at 23:55)</a>:</h4>
<p>Since this is a rewrite, I figured it may as well be done properly.</p>



<a name="189074107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189074107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189074107">(Feb 26 2020 at 00:00)</a>:</h4>
<p>Ah, that's fine. I suspect that there are places where <code>InlineAsm</code> is not handled correctly in the existing code. I can't help you with <code>Borrows</code> unfortunately, but feel free to ask about other dataflow places. As long as <code>InlineAsm</code> only has one outgoing edge it should be pretty much equivalent to the statement version as far as dataflow is concerned.</p>



<a name="189074329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189074329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189074329">(Feb 26 2020 at 00:05)</a>:</h4>
<p>If <code>InlineAsm</code> were to have multiple outgoing edges and the edge that was taken determined which outputs were assigned to, you would need to make changes to the dataflow API.</p>



<a name="189099729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189099729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189099729">(Feb 26 2020 at 09:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> Could you have a quick look at <code>src/librustc_mir/dataflow/impls/borrows.rs</code>? I <em>think</em> <code>call_return_effect</code> needs to call <code>self.kill_borrows_on_place</code>, like StatementKind::Assign does, but I'm not very familiar with what the code does.</p>



<a name="189126295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dataflow%20question/near/189126295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dataflow.20question.html#189126295">(Feb 26 2020 at 15:48)</a>:</h4>
<p>yeah I'll try to take a look today, thanks for your investigation so far.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>